#===================
# Author: Huang Gang
# Date: 2017-09-18
#===================
import web
import config

from app.helpers import paging
from app.helpers import session

#from app.models import strategies
from app.models import comments
#from app.models import votes

class comment:
    @session.login_required
    def POST(self, id):
        i = web.input(comment='')

        if i.id and i.comment:
            comments.add_comment(session.get_user_id(), id, i.comment)

        raise web.seeother(web.ctx.environ['HTTP_REFERER'])

class delete_comment:
    @session.login_required
    def GET(self, comment_id):
        comments.delete_comment(session.get_user_id(), comment_id)

        raise web.seeother(web.ctx.environ['HTTP_REFERER'])
